#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
int main() {
  for (; scanf("%d%d", &n, &m) != EOF;) {
    if (n >= m) {
      if (m % 2 == 0) {
        x = m / 2 - 1;
        y = m / 2;
      } else {
        x = n - 1 - m / 2;
        y = m / 2;
      }
    } else {
      if (n % 2 == 0) {
        x = n / 2 - 1;
        y = n / 2;
      } else {
        x = n / 2;
        y = m - 1 - n / 2;
      }
    }
    printf("%d %d\n", x, y);
  }
  return 0;
}
